package com.atmc.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

@Configuration
public class MyMvcConfig extends WebMvcConfigurationSupport {
    //增加访问路径

    @Override
    protected void addResourceHandlers(ResourceHandlerRegistry registry) {

        registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/");

    }

    //请求与页面映射

    @Override
    protected void addViewControllers(ViewControllerRegistry registry) {

        //urlPath:请求

        //setViewName:html页面

        registry.addViewController("/").setViewName("index");

    }
}
